<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
test(() => assert_selection(
  '<div contenteditable>|</div>',
  selection => {
    selection.document.execCommand('InsertText', false, ' ');
    selection.document.execCommand('InsertText', false, 'Hello');
    selection.document.execCommand('InsertText', false, ' ');
    selection.document.execCommand('InsertText', false, ' ');
    selection.document.execCommand('InsertText', false, ' ');
    selection.document.execCommand('InsertText', false, ' ');
    selection.document.execCommand('InsertText', false, ' ');
    selection.document.execCommand('InsertText', false, 'World');
    selection.document.execCommand('InsertText', false, ' ');
  },
  [
    '<div contenteditable>',
      '\u00A0Hello\u00A0 \u00A0 \u00A0World\u00A0',
    '|</div>',
  ].join('')),
  'insert " Hello     World " with extra whitespaces');
</script>
